﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Toetoe.Models.Domain;

namespace Toetoe.Infrastructure
{
    public static class ObjectContextPerHttpRequest
    {
        public static TittieEntities Context
        {
            get
            {
                string objectContextKey = HttpContext.Current.GetHashCode().ToString("x");
                if (!HttpContext.Current.Items.Contains(objectContextKey))
                    HttpContext.Current.Items.Add(objectContextKey, new TittieEntities());
                return HttpContext.Current.Items[objectContextKey] as TittieEntities;
            }
        }
    }
}